package com.example.hellodemo;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.hellodemo.widget.CustomDialog;

public class CustomDialogActivity extends AppCompatActivity {
    private Button customBtn1;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_dialog);
        customBtn1 = findViewById(R.id.customDialogBtn1);
        customBtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final CustomDialog dialog = new CustomDialog(CustomDialogActivity.this);
                dialog.setTitle("提示").setMessage("您确定要删除吗")
                        .setCancleLister("取消", new CustomDialog.CancleLister() {
                            @Override
                            public void onClickCancle(CustomDialog dialog) {
                                dialog.dismiss();
                            }
                        })
                        .setConfirmLister("确定", new CustomDialog.ConfirmLister() {
                            @Override
                            public void onClickConfirm(CustomDialog dialog) {
                                dialog.dismiss();
                            }
                        });
                dialog.show();

            }
        });
    }
}
